(0, require("../common/component").VantComponent)({
    relation: {
        type: "ancestor",
        name: "badge-group",
        linked: function(parentComponent) {
            this.parentComponent = parentComponent;
        }
    },
    props: {
        info: null,
        title: String
    },
    methods: {
        onClick: function() {
            var currentComponent = this, parentComponent = this.parentComponent;
            if (parentComponent) {
                var badgeIndex = parentComponent.badges.indexOf(this);
                parentComponent.setActive(badgeIndex).then(function() {
                    currentComponent.$emit("click", badgeIndex), parentComponent.$emit("change", badgeIndex);
                });
            }
        },
        setActive: function(activeState) {
            return this.set({
                active: activeState
            });
        }
    }
});